home *** CD-ROM | disk | FTP | other *** search
- (This is the original README file for tree, FF306, by Tomas Rokicki)
-
- Tree. A very, very simple directory tree traversal program. I wrote it for
- two reasons:
-
- - To be able to zoo directory trees
- - To be able to zoo large directories without waiting forever
- - To be able to find the large files on my disk
- - To be able to selectively `backup' files (with zoo, copy or whatnot),
- deleting a certain set of directories and file extensions.
-
- So that's what I wanted it to do. Now how it works.
-
- First, it always lists the tree starting at the current directory, and not
- prefixed by anything. Thus, if I'm in the TeX:foo directory, and there is
- one file in it called `bar', the program will list the single output line
-
- bar
-
- and that's it. All files listed are listed by the pathname starting at the
- current directory, so if TeX:foo contained a directory bar with files baz1
- and baz2, and TeX:foo also contained fubar, then the output would be
-
- bar/baz1
- bar/baz2
- fubar
-
- The files are listed in the order they are encountered, not alphabetically.
-
- Simple enough? Okay, here are the options. Each option is either an option
- keyword or a parameter. At any given time, one option keyword is in effect,
- and all parameters are added.
-
- The option keywords are:
-
- -d: Add to the list of directories to be ignored. Any parameters following
- this will be skipped in the treewalk. All parameters to this (and other)
- options are case sensitive (this is a bug since the Amiga file system
- isn't case sensitive; fix it if you like.)
-
- -x: Add to the list of file extensions to be ignored. A file extension is an
- outdated concept, in which the last part of a file name, after the last
- period, is considered an extension. Thus, the extension of a.b.c is `c';
- the file foo does not have an extension.
-
- -f: Use this (one) parameter as the output format. The output format is just
- a string, where all `%s' sequences are replaced by the file name, all
- `%d' sequences are replaced by the file size, all %% sequences are
- replaced with a single percent sign, and all other characters are taken
- verbatim. Useful if you want to build a command file that does something
- to all of the files.
-
- -h: Print a short informational message.
-
- Thus, to find the largest files on the disk, I simply use
-
- tree -f "%d %s" | sort
-
- (The sort program is also supplied as a freebie; this one reads from stdin and
- writes to stdout, or will function as the AmigaDOS one, but it's faster than
- the AmigaDOS one, even though it's written in quick and dirty C.)
-
- To make a full backup of my disk onto the Syquest, I simply
-
- cd dh0:
- tree -d tex/pk arc autodocs f18 -x dvi log o | zoo aI dh20:backup.date
-
- which doesn't backup the directories tex/pk, arc, autodocs, and f18 (since they
- are rather large and easily recreated from distribution floppies) and doesn't
- save any .dvi, .log, or .o files (since object files especially take up a fair
- proportion of the disk), and backups the entire mass with zoo onto another
- drive.
-
- This procedure (with maybe a few more directories added) can backup my entire
- 90MB disk onto a single 25MB file, which I put on a Syquest. It does take a
- while to run (perhaps an hour; never really timed it) but I let it work
- overnight.
-
- I have restored from these, so it does work.
-
- There is so many more things that can be done with `tree', but I haven't decided
- on a nice general way to express these things (ie, it should function as a `du'
- as well, and an option to `Execute()' rather than print each output line might
- be nice) but I'll add them as I need them. (Hey, the Execute() option is just
- a couple of lines of code . . . if you want it, you've got source . . .)
-
- Now, whenever I zoo, I just `tree | zoo aI' rather than `zoo'; it's so much
- faster!
-
- Enjoy!
-